

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.sql.*,java.io.*" %>
  <%
        Class.forName("oracle.jdbc.driver.OracleDriver");
       Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","pac","mca"); 

           String student_uname=request.getParameter("student_uname");
        String student_pwd=request.getParameter("student_pwd");
        String student_name=request.getParameter("student_name");
        String student_id=request.getParameter("student_id");
        
        String college_code=request.getParameter("college_code");
        out.println(college_code);
        String course=request.getParameter("course");
        String student_mobile=request.getParameter("mobile");
         String student_email=request.getParameter("email");
        out.println(student_email);
          Statement stmt=con.createStatement();
     if((student_uname !="")&&(student_pwd != "")&&(student_name != "")&&(student_id != "")&&(college_code !="")&&(course !="")&&(student_mobile !="")&&(student_email !=""))
{
     
     ResultSet rs = stmt.executeQuery("SELECT * from college_register WHERE college_code='"+college_code+"'");
if(rs.next())

         {

         PreparedStatement pstmt1=con.prepareStatement("insert into student_login values(?,?)");
         
         pstmt1.setString(1,student_uname);
         pstmt1.setString(2,student_pwd);

         pstmt1.executeUpdate();

        
        PreparedStatement pstmt2=con.prepareStatement("insert into student_register values(?,?,?,?,?)");
         
         pstmt2.setString(1,student_name);
         pstmt2.setString(2,student_id);
         pstmt2.setString(3,college_code);
         pstmt2.setString(4,course);
         pstmt2.setString(5,student_uname);
       
         pstmt2.executeUpdate();

PreparedStatement pstmt3=con.prepareStatement("insert into student_details values(?,?,?)");
      pstmt3.setString(1,student_id);
         pstmt3.setString(2,student_mobile);
         pstmt3.setString(3,student_email);
       pstmt3.executeUpdate();

        }
        

         
  %>

   
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body bgcolor="#99AAE1"><center>
       

<html>


<head>  
       <title> Student Registration</title> 
       <br><br>
      <center>  <h1> Student Registration </h1> <center>

     <STYLE Type="text/css">
			TD {Text-Align:Left; Font-Size:16pt}
			.chk:focus{
			   background-color:brown;
			  }

                  
      </style>
</head>

<body background="t5.jpg">

<h3>

<form action="srs2" method="POST">

<br><br>

<table width="700" cellpadding="5">


  
  <tr>
          <td> SSC Marks Percentage :
          <td> <input class=chk type="text" size="30" style="font-size:14pt; height:30px" name="ssc"/>
   </tr>

   <tr>
          <td> Year of passing  :
          <td> <input class=chk type="text" size="30" style="font-size:14pt; height:30px" name="ssc_year"/>
   </tr>

 <tr>
          <td> Intermediate Marks Percentage :
          <td> <input class=chk type="text" size="30" style="font-size:14pt; height:30px" name="inter"/>
   </tr>

<tr>
          <td> Year of passing  :
          <td> <input class=chk type="text" size="30" style="font-size:14pt; height:30px" name="inter_year"/>
   </tr>


 <tr>
          <td> Graduation Marks Percentage :
          <td> <input class=chk type="text" size="30" style="font-size:14pt; height:30px" name="graduation"/>
   </tr>

 <tr>
          <td> Year of passing  :
          <td> <input class=chk type="text" size="30" style="font-size:14pt; height:30px" name="graduation_year"/>
  </tr>

 <tr>
          <td> PG Marks Percentage :
          <td> <input class=chk type="text" size="30" style="font-size:14pt; height:30px" name="pg"/>
   </tr>


 <tr>
          <td> Year of passing  :
          <td> <input class=chk type="text" size="30" style="font-size:14pt; height:30px" name="pg_year"/>
   </tr>
 <tr>
     <td>technical-skills:

        <td><input class=chk type="text" size="30" style="font-size:14pt; height:30px" name="technical_skills"/></td></tr>
  

<table>

<br><br>

<center> <input type="hidden" name="student_uname" value="<%=student_uname%>"/>
 <input type ="hidden" name="student_id" value="<%=student_id%> "/>
 <input type="submit" style="height: 25px; width: 100px; background-color:darkgrey"  value="Submit"/> </center>


</form>

</h3>
</body>


</html>

      
    </body>
</html>
<%
     }

else
    {
        out.println("<html>");
     
          out.println("<body background=\"t5.jpg\">");
  
         out.println("<font size=\"4\" color=\"white\">");
         out.println("<div><div style='float:left'>");
out.println("<form action='index.html'>");
 out.println("<input type='submit' value='home'/></form></div>");
        out.println("<br> <b><center> Registration Not Successful, due to the following reasons:</center>");
        out.println(" <center>1.The College with code "+college_code+" is not available </b><br>2.All fields shouid be flled<br><br>3.you may enter invalid values</center>");
  

        out.println("</font>");

         out.println("</body>");

         out.println("</html>");   
        

        }
%>

